home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 674 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. From: dorgan@mtest.teradyne.com (Don Organ)
  2. Message-ID: <9603081943.AA02705@dawn.mtest>
  3. X-Original-Date: Fri, 8 Mar 1996 11:43:19 -0800
  4. Path: in1.uu.net!bounce-back
  5. Date: 09 Mar 96 04:39:23 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Organization: -
  8. Newsgroups: comp.std.c++
  9. Subject: Exceptions: function-try-block
  10. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  11.     iQBFAgUBMUELiOEDnX0m9pzZAQGJLQGAhptxcHAYzh4txSedelV+rZ0trfjlQe5u
  12.     NpIsYp8zguN+3raY17G9ha3YowCTvVu9
  13.     =1Vlu
  14.  
  15. In reading Chapter 15 - Exception handling in the April '95 Draft,
  16. I saw something that looked new to me:
  17.  
  18. function-try-block:
  19.     try ctor-initializer-opt function-body handler-seq
  20.  
  21. Where
  22.     try is a literal,
  23.     ctor-initializer (without the -opt) is defined in section
  24.         12.6.2 "Initializing bases and members"
  25.     function-body is defined in section 8.4 "Function Definitions"
  26.     handler-seq is the series of catch statements.
  27. function-try-block is referenced from section 8.4 as one of the 2 forms
  28. of a function-definition.
  29.  
  30. They way I interpret all of this is that the following
  31. should be legal:
  32.  
  33. class X {
  34. public:
  35.     X(int arg1=0);
  36.  
  37.     int member1;
  38.     int member2;
  39. };
  40.  
  41. X::X(int arg1) try : member1(0), member2(0)
  42. {
  43. }
  44. catch (...) {};
  45.  
  46. I.e. the try keyword precedes both the colon and the member initializer
  47. list and the catch keyword is not contained in a block.
  48. The catch handler would be entered if any exceptions were thrown
  49. either from the member initializers (not likely in this case since the
  50. members are simple types) are the body of the constructor.
  51.  
  52. What is the correct interpretation?
  53. Is there any published material regarding usage of this form?
  54. Are there any compilers that support this form?
  55.  
  56.  
  57. =======================================
  58. Don Organ     dorgan@mtest.teradyne.com
  59. Direct: 408-441-3123  FAX: 408-451-3201
  60. The Megatest Division of Teradyne, Inc.
  61. 880 Fox Lane San Jose, CA    95131-1685
  62. =======================================
  63. ---
  64. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  65. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  66. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  67. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  68. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  69.